﻿@model Easy.CMS.Product.ViewModel.ProductListWidgetViewModel

<div class="productlist container-fluid">
    <div class="row">
        @foreach (var item in Model.Products)
        {
            string url = item.Url;
            if (item.Url.IsNotNullAndWhiteSpace() || Model.DetailPageUrl.IsNotNullAndWhiteSpace())
            {
                if (url.IsNullOrWhiteSpace() && Model.DetailPageUrl.IsNotNullAndWhiteSpace())
                {
                    url = Model.DetailPageUrl + "?id=" + item.ID;
                }
            }
            <div class="@Model.Columns">
                <div class="thumbnail">
                    @if (item.ImageThumbUrl.IsNotNullAndWhiteSpace())
                    {
                        <img alt="@item.Title" title="@item.Title" src="@Url.Content(item.ImageThumbUrl)" />
                    }
                    <div class="caption">
                        <h4>
                            @if (url.IsNotNullAndWhiteSpace())
                            {
                                <a href="@Url.Content(url)">
                                    @item.Title
                                </a>
                            }
                            else
                            {
                                @item.Title
                            }                            
                        </h4>
                        @if (item.Description.IsNotNullAndWhiteSpace())
                        {
                            <p>
                                @item.Description
                            </p>
                        }
                        @if (url.IsNotNullAndWhiteSpace() && Path.HasExtension(url))
                        {
                            <p class="clearfix">
                                <a href="@Url.Content(url)" class="btn btn-default">
                                    下载
                                </a>
                            </p>
                        }

                    </div>
                </div>
            </div>
        }
        <div class="clearfix"></div>
    </div>

    @if (Model.IsPageable)
    {
        Html.Pagin(Model.Page);
    }
</div>



